package com.xy.p2p.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.p2p.dao.TmemberbadcreditDao;
import com.xy.p2p.model.Tmemberbadcredit;
import com.xy.p2p.service.TmemberbadcreditService;

@Service
@Transactional
public class TmemberbadcreditServiceImpl extends BaseServiceImpl<Tmemberbadcredit> implements
		TmemberbadcreditService {
	private TmemberbadcreditDao tmemberbadcreditDao;

	public TmemberbadcreditServiceImpl(TmemberbadcreditDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tmemberbadcreditDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tmemberbadcreditDao.checkExist("Tmemberbadcredit", paraName, paraValue);
	}

	@Override
	public List<Tmemberbadcredit> getTmemberbadcredit(Map<String, Object> map) {
		return tmemberbadcreditDao.getTmemberbadcredit(map);
	}
	@Override
	public Pagination getTmemberbadcreditByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tmemberbadcreditDao.getTmemberbadcreditByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tmemberbadcredit save(Tmemberbadcredit tmemberbadcredit) {
//		tmemberbadcredit.setModtime(new Date());
		if(tmemberbadcredit.getMbcid()==null){
			//新增
        	return super.save(tmemberbadcredit);
		}else{
			//更新
			Tmemberbadcredit tmemberbadcredit1=tmemberbadcreditDao.get(tmemberbadcredit.getMbcid());
			try {
				BeanUtil.copyNotNullProperties(tmemberbadcredit1, tmemberbadcredit);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tmemberbadcredit1);
		}
	}
}